package so.sao.code.service.domain.entity;

import lombok.Data;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import so.sao.code.service.infrastructure.enums.TASK_STATUS;

import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import java.util.UUID;

/**
 *用于记录发送消息队列的消息
 *由于网络原因消息发送成功缺无响应的场景
 */
@Entity
@Data
@EntityListeners(AuditingEntityListener.class)
public class TagTask extends BaseEntity {
    private String guid;
    private String type;
    private String payload;
    private TASK_STATUS status;

    public TagTask() {
    }

    public TagTask(String type, String payload) {
        guid = UUID.randomUUID().toString();
        this.type = type;
        this.payload = payload;
        this.status = TASK_STATUS.UNDO;
    }

    public TagTask(String guid, String type, String payload) {
        this.guid = guid;
        this.type = type;
        this.payload = payload;
        this.status = TASK_STATUS.UNDO;
    }
}
